<template>
    <svg aria-hidden="true" :class="svgClass">
        <use :xlink:href="iconName"></use>
    </svg>
</template>

<script>
export default {
    props: {
        iconClass: {
            type: String,
            required: true
        },
        className: {
            type: String,
            default: ''
        }
    },
    computed: {
        iconName() {
            return `#icon-${this.iconClass}`;
        },
        svgClass() {
            if(this.className) {
                return `za-svg-icon za-icon-${this.iconClass} ` + this.className;
            } else {
                return `za-svg-icon za-icon-${this.iconClass}`;
            }
        }
    }
};
</script>

<style>
.za-svg-icon {
    width: 1em;
    height: 1em;
    vertical-align: -0.15em;
    fill: currentColor;
    overflow: hidden;
}
</style>
